﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Automobile.service.Model;
using Automobile.service.BLL;

namespace Automobile.service.UI
{
    public partial class AddProduct : System.Web.UI.Page
    {
        ProductBll bll = new ProductBll();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            ProductModel pro = new ProductModel();

            pro.Product_Name= this.TextBox2.Text.ToString();
            pro.Product_Modelspe= this.TextBox3.Text.ToString();
            pro.Product_Bprid =decimal.Parse(this.TextBox4.Text);
            pro.Product_Price = decimal.Parse(this.TextBox5.Text);
            pro.Product_Type_Id = Convert.ToInt32(this.TextBox6.Text);
            pro.Product_Barcode = this.TextBox7.Text.ToString();
            pro.Product_frim = this.TextBox8.Text.ToString();
            pro.Product_Unit_Id =this.TextBox9.Text.ToString();
            pro.Product_Remark = this.TextBox10.Text.ToString();
            if (bll.AddProduct(pro) > 0)
            {
                Response.Write("<script>alert('添加成功!');location.href='Product.aspx';</script>");
            }
            else
            {
                Response.Write("<script>alert('添加失败!');</script>");
            }
        }

        protected void btnBack_Click(object sender, EventArgs e)
        {
            Response.Redirect("Product.aspx");
        }
    }
}